<include file="Common:header"/>
<link rel="stylesheet" href="__PUBLIC__/css/style_wx.css">
<html>
<style>
.jiantou{
	top:38%
}
#middle_content img{
		max-width:98%;
	}
#middle_content{
	margin:5px;
	padding:8px;
	max-width: 580px;
	margin-right: auto;
	margin-left: auto;
}

</style>
<body>
	<div id="middle_content">
		<{:htmlspecialchars_decode($detail['content'])}>
	</div>
	
	<include file="Common:item" />

	<include file="Common:success_bottom"/>
	
	<input type="hidden" id="aid" value="<{$detail['id']}>">
	<input type="hidden" id="select_item">
	<input type="hidden" id="activity-name" value="">
	<input type="hidden" id="select_item_b"><!--o--->
	
	<include file="Common:display_title"/>

	<div class="bdsharebuttonbox" data-tag="share_1" style="margin-left:50px;margin-bottom:-20px">
		<a class="bds_qzone" data-cmd="qzone" style="background-position:0px;background-image:url('/Public/img/qqkj.png');background-size:100%;height:40px;width:40px"></a>
		<a class="bds_tsina" data-cmd="tsina" style="background-position:0px;background-image:url('/Public/img/xlwb.png');background-size:100%;height:40px;width:40px"></a>
		<a class="bds_renren" data-cmd="renren" style="background-position:0px;background-image:url('/Public/img/renren.png');background-size:100%;height:40px;width:40px"></a>
		<a class="bds_tqq" data-cmd="tqq" style="background-position:0px;background-image:url('/Public/img/txwb.png');background-size:100%;height:40px;width:40px"></a>
		<a class="bds_weixin" data-cmd="weixin" style="background-position:0px;background-image:url('/Public/img/weixintb.png');background-size:100%;height:40px;width:40px"></a>
		<!-- <a class="bds_more" data-cmd="more">更多</a> -->
	</div>
	<script>
		window._bd_share_config = {
			common : {
				bdText : '',	
				bdDesc : '',	
				bdUrl : '<{$share_url}>', 	
				bdPic : ''
			},
			
			share : [{
				"bdSize" : 32
			}],
			selectShare : [{
				"bdselectMiniList" : ['qzone','tqq','kaixin001','bdxc','tqf']
			}]
		}
		with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
	</script>
</body>
</html>

<script>
	<?php 
		if($detail['is_wx'] == '1'):
	?>
	//绑定事件
	var children_dom = $('#js_content').children();
	for(var dom = 0;dom<children_dom.length;dom++){
		$(children_dom).eq(dom).attr('onclick','position(this)');
		$(children_dom).eq(dom).attr('data-position','ng_'+dom);
		$(children_dom).eq(dom).attr('id','ng_'+dom);
	}
	<?php else:?>
		var dom = 0;
		$("#middle_content").find('div,p,img').each(function(){
			dom = dom +1;
			$(this).attr('onclick','position(this)');
			$(this).attr('data-position','ng_'+dom);
			$(this).attr('id','ng_'+dom);
		});
		
		$("#middle_content").find('img').each(function(){
			$(this).attr('href','');
		});
		
		
		$("iframe").each(function(){
			$(this).attr('src','');
		});
		
	<?php endif;?>
	
	
	//获取当前定位
	function position(obj){
		//获取当前定位
		var offset = $(obj).offset();
		var top    = offset.top;
		var height = $(obj).height();
		//显示
		$('#dom').css('display','block');
		$('#dom').css('top',top+height);
		var value  = $(obj).attr('data-position'); 
		$('#select_item').val(value);
		var item_b = $(obj).attr('data-tid');
		if(item_b != ''){
			$('#select_item_b').val(item_b);
		}else{
			$('#select_item_b').val();
		}
		$('#dom_ajax').show();
		$('#middle_content').find('.css_background').removeClass('css_background');
		$(obj).addClass('css_background');
		event.stopPropagation(); 
	}
	
	//插入当前元素
	function insertion(obj){
		var tid = $(obj).attr('data-tid');
		$('body,html').removeClass("scrool");
		$.ajax({
		   type: "POST",
		   url: "<{:U('Home/Article/gain_item_info')}>",
		   data: "id="+tid,
		   success: function(msg){
			 if(msg.status == '-1'){
				layer.open({
					content:msg.msg
				});
				return false;
			 }else{
				var public_url = "<{:C('images_url')}>";
				var html  = group_type(msg,public_url);
				var value = $('#select_item').val();
				$('#'+value).before(html);
				$('#dom').css('display','none');
				$(obj).parents('#page4').remove();
			 }
		   }
		});
	}
	
	//显示
	function success_show(){
		$('#banner').show();
		return false;
	}
	
	function show_no(){
		$('#banner').hide();
		return false;
	}
	
	//提交
	function success(){
		var content = $('#middle_content').html();
		var aid     = $('#aid').val();
		var new_title = $('#new_title').val();
		
		if(new_title == ''){
			$('#banner').show();
			return false;
		}
		
		if(new_title != ''){
			title = new_title;
		}
		
		$('#middle_content').find('.css_background').removeClass('css_background');
		
		$.ajax({
			type: "POST",
			url: "<{:U('Home/Article/article_submit')}>",
			data: "content="+content+"&title="+title+"&type=1&aid="+aid,
			success: function(msg){
				if(msg.status == '1'){
					layer.open({
   	                    content:'保存成功',
                        btn: ['确认'],
                        yes:function(){
                           window.location.href = msg.url;
                        }
                    });
				}else{
					layer.open({
						content:msg.msg
					});
				}
			}
		});
	}
</script>
<style>
	.bds_qzone{
		background-position:0px;
		background-image:url('/Public/img/qqkj.png')
	}
</style>

